home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DJINC106.ARJ / PLOTFILE.H < prev    next >
C/C++ Source or Header  |  1992-03-29  |  3KB  |  119 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. /* 
  3. Copyright (C) 1988, 1992 Free Software Foundation
  4.     written by Doug Lea (dl@rocky.oswego.edu)
  5.     converted to use iostream library by Per Bothner (bothner@cygnus.com)
  6.  
  7. This file is part of GNU CC.
  8.  
  9. GNU CC is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY.  No author or distributor
  11. accepts responsibility to anyone for the consequences of using it
  12. or for whether it serves any particular purpose or works at all,
  13. unless he says so in writing.  Refer to the GNU CC General Public
  14. License for full details.
  15.  
  16. Everyone is granted permission to copy, modify and redistribute
  17. GNU CC, but only under the conditions described in the
  18. GNU CC General Public License.   A copy of this license is
  19. supposed to have been given to you along with GNU CC so you
  20. can know your rights and responsibilities.  It should be in a
  21. file named COPYING.  Among other things, the copyright notice
  22. and this notice must be preserved on all copies.  
  23. */
  24.  
  25. /* 
  26.    a very simple implementation of a class to output unix "plot"
  27.    format plotter files. See corresponding unix man pages for
  28.    more details. 
  29. */
  30.  
  31. #ifndef _PlotFile_h
  32. #ifdef __GNUG__
  33. #pragma interface
  34. #endif
  35. #define _PlotFile_h
  36.  
  37. #include <fstream.h>
  38.  
  39. /*   
  40.    Some plot libraries have the `box' command to draw boxes. Some don't.
  41.    `box' is included here via moves & lines to allow both possiblilties.
  42. */
  43.  
  44.  
  45. class PlotFile : public ofstream
  46. {
  47. protected:
  48.   PlotFile& cmd(char c);
  49.   PlotFile& operator << (const int x);
  50.   PlotFile& operator << (const char *s);
  51.   
  52. public:
  53.   
  54.   PlotFile() : ofstream() { }
  55.   PlotFile(int fd) : ofstream(fd) { }
  56.   PlotFile(const char *name, int mode=ios::out, int prot=0664)
  57.       : ofstream(name, mode, prot) { }
  58.   
  59. //  PlotFile& remove() { ofstream::remove(); return *this; }
  60.   
  61. //  int           filedesc() { return ofstream::filedesc(); }
  62. //  const char*   name() { return File::name(); }
  63. //  void          setname(const char* newname) { File::setname(newname); }
  64. //  int           iocount() { return File::iocount(); }
  65.   
  66.   PlotFile& arc(const int xi, const int yi,
  67.                 const int x0, const int y0,
  68.                 const int x1, const int y1);
  69.   PlotFile& box(const int x0, const int y0,
  70.                 const int x1, const int y1);
  71.   PlotFile& circle(const int x, const int y, const int r);
  72.   PlotFile& cont(const int xi, const int yi);
  73.   PlotFile& dot(const int xi, const int yi, const int dx,
  74.                 int n, const int* pat);
  75.   PlotFile& erase(); 
  76.   PlotFile& label(const char* s);
  77.   PlotFile& line(const int x0, const int y0,
  78.                  const int x1, const int y1);
  79.   PlotFile& linemod(const char* s);
  80.   PlotFile& move(const int xi, const int yi);
  81.   PlotFile& point(const int xi, const int yi);
  82.   PlotFile& space(const int x0, const int y0,
  83.                   const int x1, const int y1);
  84. };
  85. #endif
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.